import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/movie',
    component: () => import('../views/Movie'),
    children:[
        {
          path: 'hotPlaying',
          component: () => import('../views/movie/hotPlaying')
        }, 
        {
          path: 'comingSoon',
          component: () => import('../views/movie/comingSoon')
        }, 
        {
          path: '',
          redirect:'hotPlaying'
        }
    ]
  },
  {
      path: '/detail/:id',
      component: () => import('../views/Detail')

  },
  {
    path: '/cinema',
    component: () => import('../views/Cinema'),
  }, 
  {
    path: '/new',
    component: () => import('../views/New')
  }, 
  {
    path: '/mine',
    component: () => import('../views/Mine')
  }, 
  {
    path: '*',
    redirect:'/movie/hotPlaying'
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
